{layout name="layouts/admin" /}
{js href="/static/admin/plugins/jQuery/jquery-1.9.1.min.js" /}
<div class="panel-heading">banner图片列表
    <a style="float:right;margin-top:-6px;" href="/wechatgroup/banneradd" class="btn btn-primary">添加banner</a>
</div>

<div class="panel-body">
    <div class="box-body">
        <div id="example2_wrapper" class="dataTables_wrapper form-inline dt-bootstrap">
            <div class="row">
                <div class="col-sm-12">
                    <table class="table table-hover dataTable" >
                        <thead>
                        <tr>
                            <th>bannerID</th>
                            <th>图片标题</th>
                            <th>banner类型</th>
                            <th>banner图</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        {foreach $banners as $item}
                        <tr>
                            <td>{$item.id}</td>
                            <td>{$item.banner_name}</td>
                            <td>{$item.data_type==0?'医生群':'患者群'}</td>
                            <td><img src="{$item.banner_img}" style="width: 50px;height:50px;"/></td>
                            <td>
                                <a href="/wechatgroup/banneradd/{$item.id}"><i class="fa fa-pencil fa-fw" style="font-size: 20px;" title="编辑"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                                <a href="/wechatgroup/bannerdel/{$item.id}" onclick="return confirm('确定要删除该banner么？请慎重操作!!!')"><i class="fa fa-trash-o fa-lg" style="font-size: 20px;" title="删除"></i></a>

                            </td>
                        </tr>
                        {/foreach}
                        </tbody>
                    </table>
                    <div class="col-sm-7" style="float: right">
                        {php}echo trim($banners->render(),'"');{/php}
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-md-9 ">
                    {$banners[0]?"":"暂无数据"}
                </div>

            </div>
        </div>
    </div>

</div>

<script type="text/javascript">
    function cityoper(obj,dataid) {
        var datatype=$(obj).html();
        if(datatype=='在手机端显示')
        {
            //设置显示
            var itemtype=1;
            var datamsg="在手机端隐藏";
            var color="green";
        }else{
            //设置不显示
            var itemtype=0;
            var datamsg="在手机端显示";
            var color="gray";
        }
        $.ajax({
            type: "POST",
            url: "/wechatgroup/cityoper",
            data: "cityid=" + dataid+"&isshow="+itemtype,
            success: function (msg) {
                if (msg == 0) {
                    alert("设置成功");
                    $(obj).css('color',color);
                    $(obj).html(datamsg);
                }

            }
        });
    }
</script>